package com.csu.petstore.exception.Validation;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

//自定义参数校验的注解
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
//表明由哪个类来进行参数校验逻辑
@Constraint(validatedBy = {IsPhoneValidator.class})
public @interface IsPhone {
    // 校验出错时默认返回的消息
    String message() default "手机号格式错误！";
    //分组校验
    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
    //提供一个可以ban掉这个参数校验的属性
    boolean required() default true;
}
